/**
 * 游戏脚本的主入口
 */
import '../css/style.css';

import {Local} from './local.js';
import {Remote} from './remote.js';


let socket = io('ws://localhost:3000');
let local = new Local(socket);
let remote = new Remote(socket);

socket.on('waiting', function(str){
	document.querySelector('#local-status').innerHTML = str;
	document.querySelector('#remote-status').innerHTML = str;
})

socket.on('start', function(){
	document.querySelector('#local-status').innerHTML = '游戏中...';
	document.querySelector('#remote-status').innerHTML = '游戏中...';
	local.start();
})


socket.on('init', function(data){
	remote.start(data.type, data.dir);
});